package day_2022_12_to_3.year2023;

import java.util.LinkedList;
import java.util.List;

/**
 * @author haomin
 * @date 2023/04/10 20:09
 **/
public class Day4_10_Num1020 {
    class Solution {
        public int[] nextLargerNodes(ListNode head) {
            List<Integer> list = new LinkedList<>();
            while(head != null) {
                list.add(head.val);
                head = head.next;
            }
            int[] arr1 = list.stream().mapToInt(Integer::intValue).toArray();
            int[] arr2 = new int[arr1.length];
            for(int i = 0; i < arr2.length; ++i) {
                int a = arr1[i];
                for(int j = i + 1; j < arr1.length; ++j) {
                    if(a < arr1[j]) {
                        arr2[i] = arr1[j];
                        break;
                    }
                }
            }
            return arr2;
        }
    }
}